<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>拣货单预览 - 仓库管理系统</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;">
    <style type="text/css">
        .T-box {
            width: 400px;
            padding: 0 20px;
            text-align: left;
        }

        .T-box p {
            position: relative;
            height: 36px;
            line-height: 36px;
            font-size: 14px;
            margin-bottom: 15px;
        }

        .T-box p span {
            display: inline-block;
            padding-right: 15px;
            text-align: right;
            width: 110px;
            line-height: 36px;
            font-size: 14px;
        }

        .T-box p input, .T-box p select {
            width: 160px;
            padding: 0 5px;
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            border: 1px solid #d3d3d3;
            outline: none;
        }

        .T-box p i {
            padding: 0 10px;
            line-height: 36px;
            font-style: normal;
        }

        .T-box p b {
            display: inline-block;
            margin-left: 10px;
            cursor: pointer;
            width: 60px;
            height: 36px;
            line-height: 36px;
            background: #c33;
            color: #fff;
            text-align: center;
            font-size: 13px;
            font-weight: normal;
        }

        .T-result {
            margin-bottom: 0;
        }

        .T-result em {
            color: #c33;
            font-style: normal;
        }
    </style>

    <!-- content starts -->
    <!--    <blockquote class="layui-elem-quote">待发货订单</blockquote>-->

    <fieldset class="layui-elem-field">
        <legend>拣货单预览</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane1" method="get" action="/order/order_wait_pick_list">
                <div class="layui-form-item">

                    <div class="layui-inline">
                        <a class="layui-btn" href="javascript:;" id="exportPrintOrder">生成拣货单&nbsp;(总共选择&nbsp;<span th:text="${orderCount}" style="color: red;font-size: large;"></span>&nbsp;订单)</a>
                        SKU数量总共：<span th:text="${skuCount}"></span>
                    </div>

                </div>
            </form>
        </div>
    </fieldset>
    <!-- start dd-wrapper -->
    <link rel="stylesheet" href="/css/order.css"/>
    <div class="dd-wrapper">
        <form method="post" id="generating_picking" action="">
            <table class="dd-table">
                <tr>
                    <th>序号</th>
                    <th>图片</th>
                    <th>商品名</th>
                    <th>款号</th>
                    <th>款式</th>
                    <th>SKU</th>
                    <th>待出库数量</th>
                    <th>订单总数</th>
                    <th>当前库存</th>

                    <th>库位</th>

                </tr>
                <tr th:each="item:${goodsList}">
                    <td>
                       <p th:text="${itemStat.index + 1}"></p>
                    </td>
                    <td>
                       <p>
                           <img th:src="${item.getColorImage()}" style="width: 50px;">
                       </p>
                    </td>
                    <td>
                       <p th:text="${item.getGoodsName()}"></p>
                    </td>
                    <td>
                        <p th:text="${item.getGoodsNumber()}"></p>
                    </td>
                    <td>
                        <p>颜色：<span th:text="${item.getColorValue()}"></span></p>
                        <p>尺码：<span th:text="${item.getSizeValue()}"></span></p>
                    </td>
                    <td >
                        <span th:text="${item.getSpecNumber()}"></span>
                    </td>
                    <td>
                        <span th:text="${item.getSaleQty()}"></span>
                    </td>

                    <td>
                        <span th:text="${item.getOrderCount()}"></span>
                    </td>
                    <td>
                        <span th:text="${item.getCurrentQty()}"></span>
                    </td>
                    <td><span th:text="${item.getLocationNumber()}"></span></td>
                </tr>
            </table>
        </form>
    </div>
    <!-- end dd-wrapper -->



    <script src="/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#startTime'
            });
            laydate.render({
                elem: '#endTime'
            });
        });
        var r = /^\+?[1-9][0-9]*$/;
        $(function () {
//(按订单生成拣货单)
            $("#exportPrintOrder").click(function () {
                var ids = [[${ids}]];

                //console.log(ids);
                if (ids.length == 0)
                    alert("请选择订单");
                else {
                    if (confirm("你选中的订单将会生成拣货单，确认要操作吗？")) {
                        $.ajax({
                            url: "/ajax_order/generating_picking_list_by_order",
                            type: "POST",
                            dataType: "json",
                            contentType: "application/json",
                            data: JSON.stringify({id: ids}),
                            success: function (res) {
                                console.log("加入拣货清单");
                                console.log(res);
                                if (res.code == 0) {
                                    alert("成功," + res.data);
                                    // window.location.reload();
                                    window.location.href = "/order_delivery/wait_pick_order_list";
                                } else {
                                    alert(res.msg);
                                }
                            },
                            complete: function (XMLHttpRequest) {
                                if (XMLHttpRequest.getResponseHeader("REDIRECT") == "NO_ACCESS") alert("无权限访问");
                            },
                        });
                    }
                }
            });
        })
    </script>
</div>


</body>
<html>
